package com.gem.controller;

import com.gem.service.ProductCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;

/**
 * @author 刘聪
 * Created  on 2021/3/22
 */
@Controller
public class ProductCategoryController {
    @Autowired
    private ProductCategoryService productCategoryService;

    @GetMapping("/home")
    public String list(HttpSession session, Model model){
        model.addAttribute("Categorylist",productCategoryService.getAllProductCategoryVO());
        /*if(user == null){
            modelAndView.addObject("cartList",new ArrayList<>());
        }else{
//            modelAndView.addObject("cartList",cartService.findAllCartVOByUserId(user.getId()));
        }*/
        return "home";
    }
    @GetMapping("/")
    public String main(){
        return "redirect:/home";
    }
}
